<?php

/**
 * Milestone form base class.
 *
 * @method Milestone getObject() Returns the current form's model object
 *
 * @package    mysmartmanager
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseMilestoneForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'milestoneid'   => new sfWidgetFormInputHidden(),
      'name'          => new sfWidgetFormInputText(),
      'createdate'    => new sfWidgetFormDateTime(),
      'startdate'     => new sfWidgetFormDateTime(),
      'enddate'       => new sfWidgetFormDateTime(),
      'projectid'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Project'), 'add_empty' => false)),
      'estimatedcost' => new sfWidgetFormInputText(),
      'actualcost'    => new sfWidgetFormInputText(),
      'createby'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => false)),
      'version'       => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'milestoneid'   => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'milestoneid', 'required' => false)),
      'name'          => new sfValidatorString(array('max_length' => 100, 'required' => false)),
      'createdate'    => new sfValidatorDateTime(array('required' => false)),
      'startdate'     => new sfValidatorDateTime(array('required' => false)),
      'enddate'       => new sfValidatorDateTime(array('required' => false)),
      'projectid'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Project'), 'required' => false)),
      'estimatedcost' => new sfValidatorNumber(array('required' => false)),
      'actualcost'    => new sfValidatorNumber(array('required' => false)),
      'createby'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'required' => false)),
      'version'       => new sfValidatorString(array('max_length' => 5, 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('milestone[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Milestone';
  }

}
